#include<bits/stdc++.h>
using namespace std;
const int maxn=1e6;
int a[maxn+10],x[maxn];
int main()
{
	int n,m,i,num=0;
	cin>>n>>m;
	for(i=1;i<=n;i++)
		cin>>a[i];
	for(i=1;i<=m;i++)
		cin>>x[i];
	begin:
	num++;
	int l=1,r=n,firstPos=-1;
	while(l<=r)
	{
		int mid=(l+r)/2;
		if(a[mid]>x[num])
			r=mid-1;
		else if(a[mid]<x[num])
			l=mid+1;
		else
		{
			firstPos=mid;
			r=mid-1;
		}
	}
	cout<<firstPos<<" ";
	if(num<m)
		goto begin;
    return 0;
}
